import ctypes


class ICMP(ctypes.Structure):
    _fields_ = [
        ('type', ctypes.c_ubyte),
        ('code', ctypes.c_ubyte),
        ('checksum', ctypes.c_ushort),
        ('unused', ctypes.c_ushort),
        ('next_hop_mtu', ctypes.c_ushort),
    ]

    def __new__(self, socket_buffer):
        return self.from_buffer_copy(socket_buffer)

    def __init__(self, socket_buffer):
        pass


class TCP(ctypes.Structure):
    _fields_ = [
        ('s_port', ctypes.c_uint16),
        ('d_port', ctypes.c_uint16),
        ('seq', ctypes.c_uint32),
        ('ack', ctypes.c_uint32),
        ('oft', ctypes.c_ubyte),
        ('rev4', ctypes.c_ubyte),
        ('rev5', ctypes.c_bool),
        ('rev6', ctypes.c_bool),
        ('urg', ctypes.c_bool),
        ('ack', ctypes.c_bool),
        ('psh', ctypes.c_bool),
        ('rst', ctypes.c_bool),
        ('syn', ctypes.c_bool),
        ('fin', ctypes.c_bool),
        ('win', ctypes.c_uint16),
        ('ckm', ctypes.c_uint16),
        ('urgp', ctypes.c_uint16),
    ]

    def __new__(self, socket_buffer):
        return self.from_buffer_copy(socket_buffer)

    def __init__(self, socket_buffer):
        pass


